import { defineStore } from 'pinia';

// 每个 store 有一个独一无二的 id
export const useUserStore = defineStore('user', {
    state: () => ({
        username: 'guest',
        age: 18
    }),
    getters: {
        userInfo: (state) => {
            return `${state.username}, ${state.age}`;
        }
    },
    actions: {
        updateUsername(newName) {
            this.username = newName;
        }
    }
});